<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <script type="text/javascript" src="https://www.nowapi.com/style/jquery/1.11.3/jquery.min.js"></script>
  <script>
function check()
    {
      var username=sessionStorage.key(sessionStorage.length);
         if(sessionStorage.length==0)
     {
       alert("非法访问！");
         
      window.location.href='http://buptjiajing.gitee.io/buptsice_training_2017_2/用户注册2.0.html'
    
       
     }


           else { var list = document.getElementById("okname"); 
              list.innerHTML =sessionStorage.getItem("username");
         loadAll();
       }
    }


        function loadAll(){  
        var list = document.getElementById("list");  
        if(localStorage.length>0)
        {  
            var result = "<table border='1'>";  
            result += "<tr><td>用户名</td><td>密码</td><td>邮箱</td><td>注册时间</td></tr>";  
            for(var i=0;i<localStorage.length;i++)
      {  
                var sitename = localStorage.key(i);  
                var str = localStorage.getItem(sitename); 
        var site = JSON.parse(str);
                result += "<tr><td>"+sitename+"</td><td>"+site.siteurl+"</td><td>"+site.sitename+"</td><td>"+site.nowtime+"</td></tr>";  
            }  
            result += "</table>";  
            list.innerHTML = result;  
        }else{  
            list.innerHTML = "数据为空……";  
        }  
    }      






   
      function show_phone()
         {
     $.ajax({
        type          : 'GET',
        async         :  true,
    url : "http://api.k780.com/?app=phone.get&phone="+$("#phone").val()+"&appkey=29156&sign=fb1c1fa121739e397114a7f0b27fc035&format=json&jsoncallback=data",
        dataType      : 'jsonp',
        jsonp         : 'callback',
        jsonpCallback : 'data',
        success       : 
        $.getJSON("http://api.k780.com/?app=phone.get&phone="+$("#phone").val()+"&appkey=29156&sign=fb1c1fa121739e397114a7f0b27fc035&format=json&jsoncallback=data",function(result){
            
            var show = "<table border='1'>";
            show += "<tr><td>电话号码</td><td>地区</td><td>运营商</td></tr>"; 
           
           
             for(var i=0;i<result.length;i++)
             {
                show +="<tr><td>"+result.result[i].phone+"</td>";
                show +="<td>"+result.result[i].att+"</td>";
                show +="<td>"+result.result[i].operators+"</td></tr>";
              }
            show +="</table>";
          $("#test").after(show);
            
        });
       
    });
   };


$(document).ready(function(){
  $("#btn").click(function(){
   show_phone();
  });
});


    </script>
    
  <style>
  h1
  {text-align: center}
  body
    {background-color:#b0c4de;}
    </style>
  <meta charset="utf-8">
  <title>登陆成功</title>
  <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">  
  
</head>
<body>
  <div class="page-header">
    <h1>风流之家
      <small>Fengliu</small>
      </h1>
</div>
<div class="container">
  <div class="jumbotron">
    <h1>登陆成功!</h1>
    <p style="text-align: center">欢迎回来!</p>
  </div>
  <a href="http://buptjiajing.gitee.io/用户登录2.0.html" class="btn btn-primary">返回</a>

</div>
<script>check()</script>
 &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 
 <div id="okname"> </div> 
  
  <div id="list"> </div>
  <label for="phone">你的电话号码:</label> <input type="text" id="phone" ><br/>

<button id="btn">查询</button>
 <div id="#test"></div>

</body>
</html>